package com.itheima.d7_interface_demo.interface_demo2;

import java.util.ArrayList;

public class ClassManager {
    private ArrayList<Student> students = new ArrayList<>();//存放所有学生对象
    private StudentService  stu = new StudentServiceimpl2();//创建实现类对象，用接口名去接，体现了多态。更换不同方案，更改要new的实现类就行。

    public ClassManager() {
        students.add(new Student("小兮1号",'女',100));
        students.add(new Student("小兮2号",'男',90));
        students.add(new Student("小兮3号",'男',95));
        students.add(new Student("小兮4号",'女',98));
    }

    public void printInfo() {
         stu.printAllInfo(students);
    }
    public void printScore(){
        stu.printAverageScore(students);
    }
}
